package com.lmf.controller;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.lmf.vo.Student;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;

/**
 * @Controller:创建处理器对象，对象放在springmvc容器中 使用位置：在类的上面
 * 与spring框架中的用法一样
 */
@Controller
@RequestMapping("/user")
public class Mycontroller {

    /**
     * 处理器方法返回String---表示逻辑视图名称，需要配置视图解析器
     */
    @RequestMapping(value = "/some.do")
    public ModelAndView dosome(String name, Integer age) {
        System.out.println("学生姓名：" + name + "，学生年龄：" + age);
        ModelAndView mv = new ModelAndView();
        mv.addObject("name", name);
        mv.addObject("age", age);
        mv.setViewName("show");
        return mv;
    }


}
